import torch

x = torch.Tensor(2,4)
print(x) # 随机数
print(x.type)
print(x.dtype)

x1 = torch.DoubleTensor(2,2,4) # 创建两个2*4的
print(x1)

list = [[1,2,3],[4,5,6],[7,8,9]]  # 使用列表创建数组
x2 = torch.tensor(list)
print(x2)
print(x2[1, 0])

x2[1,0] = 99 # 更改个别元素
print(x2)
x2[1,] = 99
print(x2)

x3 = torch.zeros(2,4) # 0数组
print(x3)

x4 = torch.eye(5) # 对角矩阵
print(x4)

x5 = torch.ones(2,5)
print(x5)

x6 = torch.rand(2,4)
print(x6)

x7 = torch.arange(0,1,0.5)
print(x7)